import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

import server.kap02.Bean;


public class ClientBean {

	public static void main(String[] args) {
		try{
			Properties p = new Properties();
			p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
			p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
			p.put(Context.PROVIDER_URL,"jnp://localhost:1099");
			Context ctx = new InitialContext();
			Object ref = ctx.lookup("java:app/JavaEEEjb/BeanBean!server.kap02.Bean");
			Bean ebr = (Bean) PortableRemoteObject.narrow(ref, Bean.class);
			System.out.println(ebr.addieren(5, 10));
		} catch (NamingException e){e.printStackTrace();}

	}

}
